/*
 * @Date: 2019-08-31 14:21:14
 * @Github: https://github.com/FinnWu
 * @LastEditors: Finnwu
 * @LastEditTime: 2019-08-31 14:34:06
 */


 // 两个栈实现队列
 
 var stack1 = []
 var stack2 = []

function push(node){
    // write code here
    stack1.push(node)
}

function pop(){
    // write code here
    if (stack2.length !== 0) {
        return stack2.pop()
    }
    if(stack1.length === 0) {
        return null
    }
    var len = stack1.length
    while(len > 0) {
        stack2.push(stack1.pop())
        len--
    }
    return stack2.pop()
}

console.log(push(1))
console.log(push(2));
console.log(stack1);
console.log(pop())